- if can?(current_user, :push_code, @project)
  - if !@project.has_remote_mirror? && @project.mirror?
    - size = nil unless defined?(size) && size
    - if @project.updating_mirror?
      %span.btn.disabled.update-mirror-button.has-tooltip{title: "Updating from upstream..."}
        = icon('refresh')
    - else
      = link_to update_now_namespace_project_mirror_path(@project.namespace, @project), method: :post, class: "btn update-mirror-button has-tooltip", title: "Update from upstream" do
        = icon('refresh')
  - elsif @project.has_remote_mirror? && !@project.mirror?
    - if @project.updating_remote_mirror?
      %span.btn.disabled.update-mirror-button.has-tooltip{title: "Updating remote repository..."}
        = icon('refresh')
    - else
      = link_to update_now_namespace_project_mirror_path(@project.namespace, @project, sync_remote: true), method: :post, class: "btn update-mirror-button has-tooltip", title: "Update remote repository" do
        = icon('refresh')
  - elsif @project.has_remote_mirror? && @project.mirror?
    .btn-group
      %a.btn.dropdown-toggle{href: '#', 'data-toggle' => 'dropdown'}
        = icon('refresh')
      %ul.dropdown-menu.dropdown-menu-right
        %li
          - if @project.updating_mirror?
            %span.prepend-left-10.disabled-item Updating from upstream...
          - else
            = link_to "Update this repository", update_now_namespace_project_mirror_path(@project.namespace, @project), method: :post
        %li
          - if @project.updating_remote_mirror?
            %span.prepend-left-10.disabled-item Updating remote repository...
          - else
            = link_to "Update remote repository", update_now_namespace_project_mirror_path(@project.namespace, @project, sync_remote: true), method: :post
